package internact;

import java.util.HashMap;
import java.util.Map;

/**
 * 管理员管理类
 */
public class AdminManager {
    private Map<String, String> admins;
    private String currentAdmin;

    public AdminManager() {
        admins = new HashMap<>();
        admins.put("admin1", "password1");
        admins.put("admin2", "password2");
        currentAdmin = null;
    }

    public boolean login(String username, String password) {
        if (admins.containsKey(username) && admins.get(username).equals(password)) {
            currentAdmin = username;
            return true;
        } else {
            return false;
        }
    }

    public void logout() {
        currentAdmin = null;
    }

    public String getCurrentAdmin() {
        return currentAdmin;
    }
}

